﻿using BaseEntities;
using BussinessLogic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTest
{
    [TestClass]
    public class UnitTestUC3
    {
        [TestMethod]
        public void test_GetBalance()
        {
            CheckBalanceLogic cbLogic=new CheckBalanceLogic();
            decimal balanceAct = cbLogic.GetBalance("12562A434");
            Assert.AreEqual(5000000, balanceAct);
        }

        [TestMethod]
        public void test_GetBalance2()
        {
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            decimal balanceAct = cbLogic.GetBalance("12562B434");
            Assert.AreEqual(7000000, balanceAct);
        }

        [TestMethod]
        public void test_GetBalance3()
        {
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            decimal balanceAct = cbLogic.GetBalance("12562C434");
            Assert.AreEqual(0, balanceAct);
        }

        [TestMethod]
        public void test_GetBalance4()
        {
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            decimal balanceAct = cbLogic.GetBalance("12562D434");
            Assert.AreEqual(-220000, balanceAct);
        }

        [TestMethod]
        public void test_GetBalance5()
        {
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            decimal balanceAct = cbLogic.GetBalance("125");
            Assert.AreEqual(0, balanceAct);
        }

        [TestMethod]
        public void test_GetAccountCb()
        {
            Account accExp = new Account();
            accExp.AccountID = 1;
            accExp.Balance = 5000000;
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            Account accAct = new Account();
            accAct = cbLogic.GetAccountCb("12562A434");
            Assert.AreEqual(accExp.AccountID, accAct.AccountID);
            Assert.AreEqual(accExp.Balance, accAct.Balance);
        }

        [TestMethod]
        public void test_GetAccountCb2()
        {
            Account accExp = new Account();
            accExp.AccountID = 2;
            accExp.Balance = 7000000;
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            Account accAct = new Account();
            accAct = cbLogic.GetAccountCb("12562B434");
            Assert.AreEqual(accExp.AccountID, accAct.AccountID);
            Assert.AreEqual(accExp.Balance, accAct.Balance);
        }

        [TestMethod]
        public void test_GetAccountCb3()
        {
            Account accExp = new Account();
            accExp.AccountID = 3;
            accExp.Balance = 0;
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            Account accAct = new Account();
            accAct = cbLogic.GetAccountCb("12562C434");
            Assert.AreEqual(accExp.AccountID, accAct.AccountID);
            Assert.AreEqual(accExp.Balance, accAct.Balance);
        }

        [TestMethod]
        public void test_GetAccountCb4()
        {
            Account accExp = new Account();
            accExp.AccountID = 5;
            accExp.Balance = -220000;
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            Account accAct = new Account();
            accAct = cbLogic.GetAccountCb("12562D434");
            Assert.AreEqual(accExp.AccountID, accAct.AccountID);
            Assert.AreEqual(accExp.Balance, accAct.Balance);
        }

        [TestMethod]
        public void test_GetAccountCb5()
        {
            CheckBalanceLogic cbLogic = new CheckBalanceLogic();
            Account accAct = new Account();
            accAct = cbLogic.GetAccountCb("125");
            Assert.IsNull(accAct);
        }
    }
}
